package com.example.Laboratory.Controller;

import com.example.Laboratory.Entity.Lab_conditions;
import com.example.Laboratory.Service.Lab_conditionsService;
import com.example.Laboratory.Untils.ResultCode;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;

@Api(value = "Lab_conditions", description = "实验室概况文章")
@RestController
@RequestMapping(value = "/Lab_conditions")
@CrossOrigin
public class Lab_conditionsController {

    @Autowired
    Lab_conditionsService lab_conditionsService;

    @ApiOperation(value = "添加实验室概况文章", notes = "添加实验室概况文章")
    @RequestMapping(value = "/addLab_conditions", method = RequestMethod.POST, produces = "application/json;charset=utf-8")
    public Object addLab_conditions (Lab_conditions t) throws IOException {
        return ResultCode.SUCCESS.result(lab_conditionsService.addLab_conditions(t));
    }

    @ApiOperation(value = "删除实验室概况文章", notes = "删除实验室概况文章")
    @RequestMapping(value = "/deleteLab_conditions", method = RequestMethod.GET, produces = "application/json;charset=utf-8")
    public Object deleteLab_conditions (@RequestParam int lab_conditions_id) throws IOException {
        return ResultCode.SUCCESS.result(lab_conditionsService.deleteLab_conditions(lab_conditions_id));
    }

    @ApiOperation(value = "查找实验室概况文章", notes = "查找实验室概况文章")
    @RequestMapping(value = "/researchLab_conditions", method = RequestMethod.POST, produces = "application/json;charset=utf-8")
    public Object selectLab_conditions ( ) throws IOException {
        return ResultCode.SUCCESS.result(lab_conditionsService.selectLab_conditions());
    }

    @ApiOperation(value = "修改实验室概况文章", notes = "修改实验室概况文章")
    @RequestMapping(value = "/reviseLab_conditions", method = RequestMethod.POST, produces = "application/json;charset=utf-8")
    public Object updateInstrument (Lab_conditions i) throws IOException {
        return ResultCode.SUCCESS.result(lab_conditionsService.updateLab_conditions(i));
    }
}
